<template>
	<view class="mypage-container">
		<Newmsg ref="newmsg" :newmsg="newmsg"></Newmsg>
		<!-- 个人信息模块 -->
		<view class="user-info-box">
			<view class="avatar-box">
				<view class="avatar-text" v-if="hasLogin">

					<view class="name">{{userInfo.user_name?userInfo.user_name:userInfo.user_penname}}
						<view v-if="userInfo.user_type==3" class="u3">
							<view class="iconfont icon-shidirenzheng"></view>
						</view>
					</view>
					<view v-if="userInfo.user_type==3" class="vdesc">
						<view class="minitag">认证资料:{{userInfo.user_verify}}</view>
					</view>
					<view class="desc" v-else>{{userInfo.user_phone}}</view>
					<view class="logout" @click="clicklogout"><i class="iconfont icon-tuichu"></i> 退出账号</view>
				</view>
				<view v-else>
					<view class="name">
						<view class="getPhone" @click="goLogin">[点击登录]</view>
					</view>
					<view class="desc">登录后即可留言或查阅记录</view>
				</view>
			</view>

		</view>


		<view class="usual-ability-box">
			<view class="usual-ability-title">
				帮助
			</view>
			<view class="usual-ability-content">

				<view class="usual-ability-item">
					<image src="../../static/img/baijia.png"></image>
					<view class="usual-ability-item-text">
						服务协议
					</view>
				</view>
				<view class="usual-ability-item">
					<image src="../../static/img/liuliangbao.png"></image>
					<view class="usual-ability-item-text">
						留言流程
					</view>
				</view>

				<view class="usual-ability-item">
					<image src="../../static/img/zhubozhongxin.png"></image>
					<view class="usual-ability-item-text">
						常见问题
					</view>
				</view>

				<view class="usual-ability-item">
					<image src="../../static/img/chuchuangguanli.png"></image>
					<view class="usual-ability-item-text">
						关于群众呼声
					</view>
				</view>


			</view>

		</view>

		<view class="usual-ability-box">
			<view class="usual-ability-title">
				我的留言
			</view>
			<Lylist :my="1" v-if="hasLogin"></Lylist>
			<view v-else
				style="display: flex;justify-content: center;min-height:200rpx;padding-top:100rpx;font-size:32rpx">请
				<view style="color:#2b73df;margin:0 20rpx;">
					<view class="getPhone2" @click="goLogin">[登录]</view>
				</view> 后查阅
			</view>
		</view>

	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex'
	import Lylist from '@/uni_modules/Lylist/Lylist.vue';
	import Newmsg from '@/uni_modules/Lylist/newmsg.vue';
	import {
		dowxLogin
	} from '@/api/api.js';
	export default {
		components: {
			Lylist,
			Newmsg
		},
		computed: {
			...mapState(['hasLogin', 'userInfo']),
		},
		data() {
			return {
				newmsg: true,
			}
		},
		onLoad() {

		},
		onShow() {
			this.newmsg = true
		},
		onHide() {
			this.newmsg = false
		},
		methods: {
			...mapMutations(['userLogin', 'logout']),

			goLogin() {
				uni.navigateTo({
					url: "/pages/user/login"
				})
			},

			clicklogout() {
				this.logout()
			},

		},
	}
</script>

<style lang="scss">
	page {
		background-color: #F8F8F8;
	}

	.getPhone {
		background-color: transparent !important;
		border: none !important;
		color: $base-color !important;
		text-align: left !important;
		padding: 0 !important;
		font-size: 60rpx !important;

		&:after {
			border: none !important;
		}
	}

	.getPhone2 {
		background-color: transparent !important;
		border: none !important;
		color: $base-color !important;
		text-align: left !important;
		padding: 0 !important;
		font-size: 32rpx !important;
		line-height: 40rpx;

		&:after {
			border: none !important;
		}
	}

	.head {
		height: 100rpx;
	}

	/* 用户信息部分 */
	.user-info-box {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		width: 100%;
		height: 300rpx;
		position: relative;

		.logout {
			position: absolute;
			right: 40rpx;
			top: 40rpx;
			display: flex;
			font-size: 28rpx;
			align-items: center;
			color: #999;

			.iconfont {
				color: #999;
				margin-right: 5rpx;
			}
		}
	}

	.avatar-box {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: flex-start;
		align-items: center;
		padding-left: 40rpx;

	}

	.avatar-box .avatar {
		width: 116rpx;
		height: 116rpx;
		border-radius: 116rpx;
	}

	.avatar-box .avatar-text {
		padding-left: 20rpx;

	}

	.avatar-text .name {
		font-size: 50rpx;
		font-weight: 500;
		display: flex;
		color: #000002;
		align-items: center;

		.iconfont {
			font-size: 56rpx;
			color: $base-color;
		}
	}

	.avatar-text .desc {
		color: #a0a1a3;
		padding-top: 10rpx;
		font-size: 30rpx;
	}

	.avatar-text .vdesc {
		display: flex;

		.minitag {
			font-size: 28rpx;
			margin-top: 10rpx;
			background-color: $base-color;
			color: #fff;
			padding: 6rpx 15rpx;
			border-radius: 10rpx;
		}
	}

	.arrow-box {
		width: 20rpx;
		height: 20rpx;
		border-top: 3rpx solid #a9acb3;
		border-right: 3rpx solid #a9acb3;
		transform: rotate(45deg);
		margin-right: 40rpx;
	}

	.fans-box {
		display: flex;
		justify-content: space-around;
		align-items: center;
	}

	.fans-item {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	.fans-num {
		font-size: 40rpx;
		font-weight: bold;
		color: #000002;
		margin-bottom: 20rpx;
	}

	.fans-text {
		font-size: 35rpx;
		color: #919294;
	}

	.usual-ability-box {
		margin-top: 30rpx;
		background-color: #fff;
		padding: 35rpx 55rpx;
	}

	/* 常用功能 */
	.usual-ability-title {
		margin-top: 15rpx;
		font-size: 35rpx;
		font-weight: 700;
		margin-bottom: 30rpx;
	}

	.usual-ability-content {
		display: flex;
		justify-content: flex-start;
		flex-wrap: wrap;
	}

	.usual-ability-item {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		width: 160rpx;
		height: 160rpx;
	}

	.usual-ability-item image {
		width: 40rpx;
		height: 40rpx;
		margin-bottom: 25rpx;
	}

	.usual-ability-item-text {
		font-size: 25rpx;
		font-weight: 400;
	}
</style>